$def with(form)
$var title: 添加活动
$var gmap: 1

<h1>添加活动</h1>
<div class="left_side">
    <script type="text/javascript">
        $$(document).ready(function() {
                $$("#gather_day").simpleDatepicker();
                $$("#start_day").simpleDatepicker();
                });
    </script>
    <form method="POST">
        <p>标题 $:form.subject.render() </p>
        <p>类型 $:form.type.render() </p>
        <p>基础积分 $:form.basecredit.render()  积分公式: (参加人数+基数) * 基础积分</p>
        <p>集合时间 $:form.gather_day.render() $:form.gather_hour.render() : $:form.gather_min.render() </p>
        <p>出发时间 $:form.start_day.render() $:form.start_hour.render() : $:form.start_min.render() </p>
        $:form.x.render() 
        $:form.y.render()
        $:form.acc.render()
        <p>距离 $:form.distance.render() 公里 </p>
        <p>
        集合地点 $:form.gather_area.render() $:form.gather_location.render() 
        <span id="notice" style="background:#FFF6ED; display: none">如果结果不对，请手动修改</span>
        </p>
        <p>路线: $:form.route.render() </p>
        <p>补充内容 $:form.descr.render() </p>
        <p>
        <input class="submit" type="submit" value="确定" name="event_submit">
        <input class="submit" type="button" onclick="javascript:history.go(-1)" value="取消" name="event_cancel">
        </p>
    </form>
</div>
<div class="right_side">
<div id="map_lay" style="background-color: white; width:100%; height:520px; border:solid 1px; float: left">
    <span style="margin: 5px 0 0 8px">请在地图上拖动图标，选择详细地址</span><br/>
    <div id="map" style="width:100%; height: 500px; margin: 5px 0 0 0"></div>
    <script type="text/javascript">
    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        var center = new GLatLng(39.917, 116.397);
        $$("#x").val(39.917);
        $$("#y").val(116.397);
        $$("#acc").val(8);

        map.setUIToDefault();
        map.setCenter(center, 12);

        var marker = new GMarker(center, {draggable: true});

        GEvent.addListener(marker, "dragstart", function() {
                map.closeInfoWindow();
                });

        GEvent.addListener(marker, "dragend", function() {
                var latlng = marker.getLatLng();
                var geocoder = new GClientGeocoder();


                if (latlng != null) {
                geocoder.getLocations(latlng, function(resp) {
                    if (!resp || resp.Status.code != 200) {
                        $$("#x").val(0);
                        $$("#y").val(0);
                        $$("#acc").val(0);
                        ALERT("无法解析的地址");
                    } else {
                        place = resp.Placemark[0];
                        marker.openInfoWindow(
                            place.address 
                            );

                        $$("#x").val(latlng.lat());
                        $$("#y").val(latlng.lng());
                        $$("#acc").val(place.AddressDetails.Accuracy);

                        $$("#gather_location").val(place.address);
                        $$("#notice").show();
                    }
                    });
                }
        });
        map.addOverlay(marker);
      }
    }

    //]]>
    </script>
</div>
</div>


